/**
 * API 管理
 */
import myAxios from '@/api/myAxios'
import mockAxoios from '@/api/mockAxios'

// 请求三级联动数据
export const reqGetCategoryList = () => myAxios.get('/product/getBaseCategoryList')
// 请求轮播图数据
export const reqGetBannerList = () => mockAxoios.get('/banner')
// 请求Floor数据
export const reqGetFloorList = () => mockAxoios.get('/floor')   
// 请求搜索详情数据
export const reqGetSearchList = (params) => myAxios({ url: '/list', method: 'post', data: params })
// 请求商品详情数据
export const reqGetGoodsInfo = (skuId) => myAxios.get(`/item/${skuId}`)
// 添加到购物车
export const reqAddOrUpdateShopcart = (skuId, skuNum) => myAxios({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })
// 获取购物车列表
export const reqGetShopcartList = () => myAxios.get('/cart/cartList')
// 删除购物车商品
export const reqDeleteCartById = (skuId) => myAxios({ url: `/cart/deleteCart/${skuId}`, method: 'delete' })
// 切换商品选中状态
export const reqUpdateCheckedById = (skuId, isChecked) => myAxios.get(`/cart/checkCart/${skuId}/${isChecked}`)
// 获取验证码
export const reqGetCode = (phone) => myAxios.get(`/user/passport/sendCode/${phone}`)
// 注册
export const reqUserRegister = (user) => myAxios({ url: '/user/passport/register', method: 'post', data: user })
// 登陆
export const reqUserLogin = (user) => myAxios({ url: '/user/passport/login', method: 'post', data: user })
// 获取用户信息(token)
export const reqGetUserInfo = () => myAxios.get('/user/passport/auth/getUserInfo')
// 退出登陆
export const reqLogout = () => myAxios.get('/user/passport/logout')
// 获取用户地址信息
export const reqGetAddressInfo = () => myAxios.get('/user/userAddress/auth/findUserAddressList')
// 获取用户订单商品信息
export const reqGetUserOrderList = () => myAxios.get('/order/auth/trade')
// 提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo}
export const reqSubmitOrder = (tradeNo, data) => myAxios({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, method: 'post', data })
// 获取订单支付信息
export const reqGetPayInfo = (orderId) => myAxios.get(`/payment/weixin/createNative/${orderId}`)
// 获取订单支付状态
export const reqGetPayStatus = (orderId) => myAxios.get(`/payment/weixin/queryPayStatus/${orderId}`)
// 获取我的订单
export const reqGetMyOrderList = (page, limit) => myAxios.get(`/order/auth/${page}/${limit}`)
